package com.ssy.jt808.gateway.sdk.terminal.constant.location;

import java.util.Map;
import java.util.TreeMap;

/**
 * jt808 0x0200 位置信息告警状态枚举
 *
 * @author wangzezhou
 */
public enum LocationAlarmEnum{

  /** 0 紧急警报 */
  Sos(LocationAlarmBitConstant.SOS),
  /** 1 超束警报 */
  OverSpeed(LocationAlarmBitConstant.OVER_SPEED),
  /** 2 疲劳驾驶 */
  FatigueDriving(LocationAlarmBitConstant.FATIGUE_DRIVING),
  /** 3 危险预警 */
  DangerWarning(LocationAlarmBitConstant.DANGER_WARNING),
  /** 4 gnss 模块故障 */
  GnssFailure(LocationAlarmBitConstant.GNSS_FAILURE),
  /** 5 gnss 天线未接或故障 */
  GnssAntennaeFailure(LocationAlarmBitConstant.GNSS_ANTENNAE_FAILURE),
  /** 6 gnss 天线短路 */
  GnssAntennaeCircuit(LocationAlarmBitConstant.GNSS_ANTENNAE_CIRCUIT),
  /** 7 主电源欠压 */
  UnderPowered(LocationAlarmBitConstant.UNDER_POWERED),
  /** 8 电源掉电 */
  PowerDown(LocationAlarmBitConstant.POWER_DOWN),
  /** 9 设备LCD或显示器故障 */
  DisplayFailure(LocationAlarmBitConstant.DISPLAY_FAILURE),
  /** 10 目标跟踪模块故障 */
  TtsFailure(LocationAlarmBitConstant.TTS_FAILURE),
  /** 11 摄像头故障 */
  CameraFailure(LocationAlarmBitConstant.CAMERA_FAILURE),
  /** 12 道路运输证 IC 卡模块故障 */
  TransportIcFailure(LocationAlarmBitConstant.TRANSPORT_IC_FAILURE),
  /** 13 超速预警 */
  OverSpeedWarning(LocationAlarmBitConstant.OVER_SPEED_WARNING),
  /** 14 疲劳驾驶预警 */
  FatigueDrivingWarning(LocationAlarmBitConstant.FATIGUE_DRIVING_WARNING),
  /** 15-17  保留 */
  /** 18 累计驾驶时间超时 */
  DrivingOvertime(LocationAlarmBitConstant.DRIVING_OVERTIME),
  /** 19 超时停车 */
  StopOvertime(LocationAlarmBitConstant.STOP_OVERTIME),
  /** 20 进出区域报警 */
  InOutArea(LocationAlarmBitConstant.IN_OUT_AREA),
  /** 21 进出路线 */
  InOutPath(LocationAlarmBitConstant.IN_OUT_PATH),
  /** 22 路线行驶时间不足/过长 */
  RouteDriveTimeAlarm(LocationAlarmBitConstant.RouteDriveTimeAlarm),
  /** 23 路线偏离 */
  DeviationPath(LocationAlarmBitConstant.DEVIATION_PATH),
  /** 24 车速传感器（vss）故障 */
  VssFailure(LocationAlarmBitConstant.VSS_FAILURE),
  /** 25 车辆油量异常 */
  FuelCapacity(LocationAlarmBitConstant.FUEL_CAPACITY_ANOMALY),
  /** 26 车辆被盗 */
  Stealing(LocationAlarmBitConstant.STEALING),
  /** 27 车辆被盗 */
  IllegalStart(LocationAlarmBitConstant.ILLEGAL_START),
  /** 28 车辆非位移 */
  IllegalDisplace(LocationAlarmBitConstant.ILLEGAL_DISPLACE),
  /** 29 碰撞预警 */
  CrashWarning(LocationAlarmBitConstant.CRASH_WARNING),
  /** 30 侧翻预警 */
  RolloverWarning(LocationAlarmBitConstant.ROLLOVER_WARNING),
  /** 31 非法开门 */
  IllegalOpenDoor(LocationAlarmBitConstant.ILLEGAL_OPEN_DOOR);

  private int bit;

  LocationAlarmEnum( int bit ){
    this.bit = bit;
  }

  public int bit(){
    return this.bit;
  }


  private static final Map<String,LocationAlarmEnum> MAP;

  static{
    MAP = new TreeMap<>();
    LocationAlarmEnum[] values = LocationAlarmEnum.values();
    for(LocationAlarmEnum value : values){
      MAP.put(value.name(), value);
    }
  }

  public static LocationAlarmEnum map( String name ){
    return MAP.get(name);
  }
}
